<style>
#komerContacts label{
	width:80px;
}
#komerContacts input[type=text]:disabled{
	color:#000;
}
#komerContacts select option[type='3']{
	display:none;
}
#komerContacts #right, #komerContacts #left{
	float:left
}
#komerContacts #right{
	margin-left:1px;
}
#komerContacts #left form{
	width:270px;
}
#komerContacts #left form input[type=submit]{
	float:right;
}
#komerContacts #right table tr[active='0'] td{
	-moz-opacity:0.3;
}
#komerContacts #right table tr[active='0'] td:last-child{
	-moz-opacity:1;
}
#komerContacts #right table input[type=button]{
	width:16px;
	height:16px;
	border:none;
	background-color:transparent;
	cursor:pointer;
}
#komerContacts #right table input[type=button].actdeact{
	background-image:url(gui/icons/actdeact.gif);
	background-repeat:no-repeat;
	background-position:center center;
}
</style>
<div id="komerContacts">
<h1>Komercijala kontakti</h1>
<div id="left">
	<form class="area" action="javascript:void(0)" onSubmit="submitForm(this,'rokovnik.php','POST','setContent',1)">
		<input type="hidden" name="a" value="kom" />
		<input type="hidden" name="mod" value="contact" />
		<input type="hidden" name="filter" value="1" />
		<h2>Pretraga</h2>
		<label class="left" for="filter_komercijalista">Komercijalista:</label>
		<input type="text" name="filter_komercijalista" id="filter_komercijalista" value="{{$filter_komercijalista}}" />
		<br clear="all" />
		
		<label class="left" for="filter_komitent">Komitent:</label>
		<input type="text" name="filter_komitent" id="filter_komitent" value="{{$filter_komitent}}" />
		<br clear="all" />
		
		<label class="left" for="filter_lokacija">Lokacija:</label>
		<input type="text" name="filter_lokacija" id="filter_lokacija" value="{{$filter_lokacija}}" />
		<br clear="all" />
		
		<input type="submit" value="filter" />
	</form><br clear="all" />
	<form class="area" action="javascript:void(0)" onSubmit="submitForm(this,'rokovnik.php','POST','alert',1)" style="margin-top:1px;">
		<input type="hidden" name="a" value="kom" />
		<input type="hidden" name="mod" value="contactAdd" />
		<h2>Novi</h2>
		<label class="left" for="add_komercijalista">Komercijalista:</label>
		<select name="add_komercijalista" id="add_komercijalista">
			{{%loop start radnik_id}}
			<option value="{{$radnik_id}}">{{$radnik_ime}}&nbsp;{{$radnik_prezime}}</option>
			{{%loop end}}
		</select>
		<br clear="all" />
		
		<label class="left" for="add_komitent">Komitent:</label>
		<input type="text" name="add_komitent" id="add_komitent" value="" disabled="disabled" />
		<input type="hidden" name="add_komitent_id" id="add_komitent_id" value="" />
		<input type="button" class="searchBtn" onClick="selectKomitent('add_komitent','add_komitent_id')" />
		<br clear="all" />
		
		<label class="left" for="add_lokacija">Lokacija:</label>
		<select name="lok_tip" onchange="var al=document.getElementById('add_lokacija').options; var si=null; for(i=0;i<al.length;i++){if(al[i].getAttribute('type')==this.value){al[i].style.display='block'; al[i].disabled=false; if(si==null){si=i}}else{al[i].style.display='none'; al[i].disabled=true;}} al.selectedIndex=si  ">
			<option value="1">grad</option>
			<option value="2">lok.opština</option>
			<option value="3">naselje</option>
		</select>
		<br clear="all" />
		<label class="left">&nbsp;</label>
		<select name="add_lokacija" id="add_lokacija">
			{{%loop start lid}}
			<option value="{{$lid}}" type="{{$lok_tip}}">{{$lok_name}}</option>
			
			{{%loop end}}
		</select>
		<br clear="all" />
		
		<label class="left" for="add_date">Datum:</label>
		<input type="text" class="dateInput" name="add_date" id="add_date" />
		<input type="button" class="datePicker" onclick="displayDatePicker('add_date',this)" />
		
		<br clear="all" />
		<input type="button" class="delete" value="Raskini sve veze" onclick="var komer=document.getElementById('add_komercijalista').value; if(komer>0){if(confirm('Da li ste sigurni da želite da raskinete sve veze za odabranog komercijalistu?')){LoadRSDoc('rokovnik.php?a=kom&mod=deactAll&id='+komer,'alert');}}else{alert('Morate odabrati komercijalistu!')}" />
		<input type="submit" value="sačuvaj" class="save" />
	</form>
</div>
<div id="right" class="area">
	{{$comment_start}}
	<table>
		<tr class="head">
			<td>komercijalista</td>
			<td>komitent</td>
			<td>lokacija</td>
			<td>vreme unosa</td>
			<td>vreme ishoda</td>
			<td></td>
		</tr>
		{{%loop start id}}
		<tr active="{{$active}}">
			<td>{{$komercijalista}}</td>
			<td>{{$komitent}}</td>
			<td>{{$lokacija}}</td>
			<td>{{$vreme_unosa}}</td>
			<td>{{$vreme_ishoda}}</td>
			<td>
				<input title="Obriši..." type="button" class="delete" onclick="if(confirm('Da li ste sigurni da želite daobrišete kontakt')){LoadRSDoc('rokovnik.php?a=kom&mod=del&id={{$id}}','alert')}" value="" />
				<input title="Aktiviraj/Deaktiviraj" type="button" class="actdeact" onclick="LoadRSDoc('rokovnik.php?a=kom&mod=actDeact&act={{$active}}&id={{$id}}','alert')" />
			</td>
		</tr>
		{{%loop end}}
	</table>
	{{$comment_end}}
</div>
</div>